package org.example;

public class Student {
    // 学生基本属性
    private String name;     // 姓名
    private String gender;   // 性别
    private int age;         // 年龄
    private String hobby;    // 爱好

    // 构造方法
    public Student(String name, String gender, int age, String hobby) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.hobby = hobby;
    }

    // Getter和Setter方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    // 重写toString方法，方便打印学生信息
    @Override
    public String toString() {
        return "学生{" +
                "姓名='" + name + '\'' +
                ", 性别='" + gender + '\'' +
                ", 年龄=" + age +
                ", 爱好='" + hobby + '\'' +
                '}';
    }
}
